package com.pd.backend.controller;

import com.pd.backend.pojo.PdArea;
import com.pd.backend.service.PdAreaService;
import com.pd.backend.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 区域控制层
 */
@RestController
@RequestMapping("/area")
@Slf4j
@Api(tags = "地址区域")
public class PdAreaController {
    @Autowired
    private PdAreaService pdAreaService;
    /**
     * 根据父id查询区域
     * @return
     */
    @ApiOperation("根据父id查询区域")
    @GetMapping("/selectAreasByParentId")
    public ResponseResult<List<PdArea>> selectAreasByParentId(Integer parentId){
        return pdAreaService.selectAreasByParentId(parentId);
    }
}